<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="出库单号" prop="exitWarehouseNumber">
        <el-input
          v-model="queryParams.exitWarehouseNumber"
          placeholder="请输入出库单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出库客户" prop="exitWarehouseCustomer">
        <el-select v-model="queryParams.exitWarehouseCustomer" placeholder="请选择出库客户" clearable filterable>
          <el-option
          v-for="dict in customerOptions"
              :key="dict.customerId"
              :label="dict.customerName"
              :value="dict.customerName"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="提货单位" prop="pickUpCustomer">
        <el-input
          v-model="queryParams.pickUpCustomer"
          placeholder="请输入提货单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--el-form-item label="发货方式" prop="exitTransportVehicle">
        <el-select v-model="queryParams.exitTransportVehicle" placeholder="请选择发货方式" clearable>
          <el-option
            v-for="dict in dict.type.transport_mode"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item-->
      <el-form-item label="出库运输" prop="exitTransportMark">
        <el-select v-model="queryParams.exitTransportMark" placeholder="请选择出库运输" clearable>
          <el-option
            v-for="dict in dict.type.transport_mark"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="出库车号" prop="exitWarehouseVehicle">
        <el-input
          v-model="queryParams.exitWarehouseVehicle"
          placeholder="请输入出库车号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--el-form-item-- label="出库司机" prop="exitWarehouseDriver">
        <el-input
          v-model="queryParams.exitWarehouseDriver"
          placeholder="请输入出库司机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item-->
      <!--el-form-item label="联系电话" prop="exitWarehouseMobile">
        <el-input
          v-model="queryParams.exitWarehouseMobile"
          placeholder="请输入联系电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="identityCardNumber">
        <el-input
          v-model="queryParams.identityCardNumber"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="外部单号" prop="externalOrderNumber">
        <el-input
          v-model="queryParams.externalOrderNumber"
          placeholder="请输入外部单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="捆包号" prop="bundleNumber">
        <el-input
          v-model="queryParams.bundleNumber"
          placeholder="请输入捆包号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="货物类型" prop="goodsType">
        <el-select v-model="queryParams.goodsType" placeholder="请选择货物类型" clearable>
          <el-option
            v-for="dict in dict.type.goods_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="品名" prop="product">
        <el-input
          v-model="queryParams.product"
          placeholder="请输入品名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="规格" prop="specification">
        <el-input
          v-model="queryParams.specification"
          placeholder="请输入规格"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="材质" prop="steelGrade">
        <el-input
          v-model="queryParams.steelGrade"
          placeholder="请输入材质"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计重方式" prop="weightMode">
        <el-select v-model="queryParams.weightMode" placeholder="请选择计重方式" clearable>
          <el-option
            v-for="dict in dict.type.weight_mode"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item-->
      <el-form-item label="重量(吨)" prop="weight">
        <el-input
          v-model="queryParams.weight"
          placeholder="请输入重量(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--el-form-item label="磅重(吨)" prop="poundWeight">
        <el-input
          v-model="queryParams.poundWeight"
          placeholder="请输入磅重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="理重(吨)" prop="theoryWeight">
        <el-input
          v-model="queryParams.theoryWeight"
          placeholder="请输入理重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毛重(吨)" prop="grossWeight">
        <el-input
          v-model="queryParams.grossWeight"
          placeholder="请输入毛重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="皮重(吨)" prop="tareWeight">
        <el-input
          v-model="queryParams.tareWeight"
          placeholder="请输入皮重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="净重(吨)" prop="netWeight">
        <el-input
          v-model="queryParams.netWeight"
          placeholder="请输入净重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扣重(吨)" prop="deductWeight">
        <el-input
          v-model="queryParams.deductWeight"
          placeholder="请输入扣重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="余重(吨)" prop="remainWeight">
        <el-input
          v-model="queryParams.remainWeight"
          placeholder="请输入余重(吨)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="件数" prop="numberOfPiece">
        <el-input
          v-model="queryParams.numberOfPiece"
          placeholder="请输入件数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合约号" prop="agreementNumber">
        <el-input
          v-model="queryParams.agreementNumber"
          placeholder="请输入合约号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同号" prop="contractNumber">
        <el-input
          v-model="queryParams.contractNumber"
          placeholder="请输入合同号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产日期" prop="produceDate">
        <el-date-picker clearable
          v-model="queryParams.produceDate"
          style="width: 205px"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择生产日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="记录来源" prop="recordSource">
        <el-input
          v-model="queryParams.recordSource"
          placeholder="请输入记录来源"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库存状态" prop="inventoryStatus">
        <el-select v-model="queryParams.inventoryStatus" placeholder="请选择库存状态" clearable>
          <el-option
            v-for="dict in dict.type.inventory_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="仓库类型" prop="warehouseType">
        <el-select v-model="queryParams.warehouseType" placeholder="请选择仓库类型" clearable>
          <el-option
            v-for="dict in dict.type.warehouse_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="园区信息" prop="logisticsParkName">
        <el-select v-model="queryParams.logisticsParkName" placeholder="请选择园区信息" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="仓位信息" prop="warehouseLocateName">
        <el-select v-model="queryParams.warehouseLocateName" placeholder="请选择仓位信息" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="区位信息" prop="regionLocateName">
        <el-select v-model="queryParams.regionLocateName" placeholder="请选择区位信息" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="货位信息" prop="goodsLocateName">
        <el-select v-model="queryParams.goodsLocateName" placeholder="请选择货位信息" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="层位信息" prop="layerLocateName">
        <el-select v-model="queryParams.layerLocateName" placeholder="请选择层位信息" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="库位信息" prop="warehouseTotalLocate">
        <el-input
          v-model="queryParams.warehouseTotalLocate"
          placeholder="请输入库位信息"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="目的流向" prop="endFlowDirection">
        <el-select v-model="queryParams.endFlowDirection" placeholder="请选择目的流向" clearable>
          <el-option
              v-for="dict in beginFlowOptions"
              :key="dict.flowDirectionId"
              :label="dict.flowDirectionName"
              :value="dict.flowDirectionName"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="目的卸点" prop="endUnloadPoint">
        <el-input
          v-model="queryParams.endUnloadPoint"
          placeholder="请输入目的卸点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="运单编号" prop="wayBillNumber">
        <el-input
          v-model="queryParams.wayBillNumber"
          placeholder="请输入运单编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出库时间">
        <el-date-picker
          v-model="daterangeExitWarehouseTime"
          style="width: 205px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="出库确认人" prop="exitWarehouseConfirmPerson">
        <el-input
          v-model="queryParams.exitWarehouseConfirmPerson"
          placeholder="请输入出库确认人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出库确认时间">
        <el-date-picker
          v-model="daterangeExitWarehouseConfirmTime"
          style="width: 205px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input
          v-model="queryParams.remark"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="作业状态" prop="jobStatus">
        <el-select v-model="queryParams.jobStatus" placeholder="请选择作业状态" clearable>
          <el-option
            v-for="dict in dict.type.job_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="结算客户" prop="settlementCustomer">
        <el-select v-model="queryParams.settlementCustomer" placeholder="请选择结算客户" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="结算方式" prop="settlementMode">
        <el-select v-model="queryParams.settlementMode" placeholder="请选择结算方式" clearable>
          <el-option
            v-for="dict in dict.type.settlement_mode"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="账单编号" prop="billNumber">
        <el-input
          v-model="queryParams.billNumber"
          placeholder="请输入账单编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="账单状态" prop="billStatus">
        <el-select v-model="queryParams.billStatus" placeholder="请选择账单状态" clearable>
          <el-option
            v-for="dict in dict.type.bill_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="园区代码" prop="parkCode">
        <el-input
          v-model="queryParams.parkCode"
          placeholder="请输入园区代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item-->
      <el-form-item label="创建者" prop="createBy">
        <el-input
          v-model="queryParams.createBy"
          placeholder="请输入创建者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="daterangeCreateTime"
          style="width: 205px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-col>
      <!--el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['exitwarehouse:receipt:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['exitwarehouse:receipt:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['exitwarehouse:receipt:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['exitwarehouse:receipt:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-baseball"
          size="mini"
          :disabled="single"
          @click="handleAddGoods"
          v-hasPermi="['exitwarehouse:receipt:goods']"
        >加货</el-button>
      </el-col-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-s-home"
          size="mini"
          :disabled="single"
          @click="handleExitRevoke"
          v-hasPermi="['exitwarehouse:receipt:revoke']"
        >撤销出库</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-printer"
          size="mini"
          :disabled="multiple"
          @click="handlePrint"
          v-hasPermi="['exitwarehouse:receipt:print']"
        >打印</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-s-promotion"
          size="mini"
          :disabled="multiple"
          @click="handleWaybill"
          v-hasPermi="['exitwarehouse:receipt:waybill']"
        >推送运单</el-button>
      </el-col>
      <el-col :span="1.5" v-for="(item, index) in exitWeightSumList" :key="index">
        <el-tag type="" size="medium" effect="dark" >{{ item.inventoryStatus }} : {{ item.weightSum }}</el-tag>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" @computeTable="computeTableHeight"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" ref="dataList" :data="receiptList" @selection-change="handleSelectionChange" @row-click="handleRowClick" border :height="tableHeight" :row-style="{height:'35px'}" :cell-style="{padding:'0px'}">
      <el-table-column type="selection" width="45" align="center" />
      <el-table-column type="index" prop="" width="55" label="序号" align="center" >
        <template slot-scope="scope">
          <span>{{ scope.$index+1 +(queryParams.pageNum-1)*queryParams.pageSize }}</span>
        </template>
      </el-table-column>
      <!--el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100%">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['exitwarehouse:receipt:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['exitwarehouse:receipt:remove']"
          >删除</el-button>
        </template>
      </el-table-column-->
      <!--el-table-column label="出库ID" align="center" prop="exitWarehouseId" /-->
      <el-table-column label="出库单号" align="center" prop="exitWarehouseNumber" width="160" :show-overflow-tooltip="true" />
      <el-table-column label="出库客户" align="center" prop="exitWarehouseCustomer" width="240" :show-overflow-tooltip="true" />
      <el-table-column label="提货单位" align="center" prop="pickUpCustomer" width="240" :show-overflow-tooltip="true" />
      <!--el-table-column label="发货方式" align="center" prop="exitTransportVehicle" /-->
      <el-table-column label="出库运输" align="center" prop="exitTransportMark" />
      <el-table-column label="出库车号" align="center" prop="exitWarehouseVehicle" width="110" />
      <el-table-column label="出库司机" align="center" prop="exitWarehouseDriver" />
      <el-table-column label="联系电话" align="center" prop="exitWarehouseMobile" width="110" />
      <!--el-table-column label="身份证号" align="center" prop="identityCardNumber" width="180" /-->
      <!--el-table-column label="外部单号" align="center" prop="externalOrderNumber" width="120" :show-overflow-tooltip="true" /-->
      <!--el-table-column label="捆包号" align="center" prop="bundleNumber" /-->
      <el-table-column label="货物类型" align="center" prop="goodsType" />
      <!--el-table-column label="品名" align="center" prop="product" />
      <el-table-column label="规格" align="center" prop="specification" />
      <el-table-column label="材质" align="center" prop="steelGrade" /-->
      <!--el-table-column label="计重方式" align="center" prop="weightMode" /-->
      <el-table-column label="重量(吨)" align="center" prop="weight" />
      <!--el-table-column label="磅重(吨)" align="center" prop="poundWeight" /-->
      <!--el-table-column label="理重(吨)" align="center" prop="theoryWeight" width="90" /-->
      <!--el-table-column label="毛重(吨)" align="center" prop="grossWeight" />
      <el-table-column label="皮重(吨)" align="center" prop="tareWeight" />
      <el-table-column label="净重(吨)" align="center" prop="netWeight" />
      <el-table-column label="扣重(吨)" align="center" prop="deductWeight" /-->
      <!--el-table-column label="余重(吨)" align="center" prop="remainWeight" /-->
      <!--el-table-column label="件数" align="center" prop="numberOfPiece" />
      <el-table-column label="合约号" align="center" prop="agreementNumber" /-->
      <el-table-column label="合同号" align="center" prop="contractNumber" width="160" :show-overflow-tooltip="true" />
      <!--el-table-column label="生产日期" align="center" prop="produceDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.produceDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="记录来源" align="center" prop="recordSource" />
      <el-table-column label="库存状态" align="center" prop="inventoryStatus" />
      <el-table-column label="仓库类型" align="center" prop="warehouseType" />
      <el-table-column label="园区信息" align="center" prop="logisticsParkName" />
      <el-table-column label="仓位信息" align="center" prop="warehouseLocateName" />
      <el-table-column label="区位信息" align="center" prop="regionLocateName" />
      <el-table-column label="货位信息" align="center" prop="goodsLocateName" />
      <el-table-column label="层位信息" align="center" prop="layerLocateName" />
      <el-table-column label="库位信息" align="center" prop="warehouseTotalLocate" /-->
      <!--el-table-column label="目的流向" align="center" prop="endFlowDirection" width="240" :show-overflow-tooltip="true" /-->
      <!--el-table-column label="目的卸点" align="center" prop="endUnloadPoint" /-->
      <!--el-table-column label="运单编号" align="center" prop="wayBillNumber" width="100" :show-overflow-tooltip="true"/-->
      <el-table-column label="出库时间" align="center" prop="exitWarehouseTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.exitWarehouseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出库确认" align="center" prop="exitWarehouseConfirmPerson" />
      <el-table-column label="出库确认时间" align="center" prop="exitWarehouseConfirmTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.exitWarehouseConfirmTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <!--el-table-column label="备注" align="center" prop="remark" width="180" :show-overflow-tooltip="true" /-->
      <!--el-table-column label="作业状态" align="center" prop="jobStatus" /-->
      <el-table-column label="结算客户" align="center" prop="settlementCustomer" />
      <el-table-column label="结算方式" align="center" prop="settlementMode" />
      <!--el-table-column label="账单编号" align="center" prop="billNumber" />
      <el-table-column label="账单状态" align="center" prop="billStatus" /-->
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!--Good Detail-->
    <div class="line" />

    <goodsDetail ref="goodsDetail" />

    <!-- 添加或修改出库单据对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <!--el-form-item label="出库单号" prop="exitWarehouseNumber">
          <el-input v-model="form.exitWarehouseNumber" placeholder="请输入出库单号" clearable />
        </el-form-item-->
        <el-form-item label="出库客户" prop="exitWarehouseCustomer">
          <el-select v-model="form.exitWarehouseCustomer" placeholder="请选择出库客户" style="width: 340px;" clearable filterable @change="handleChangeCustomer">
            <el-option
            v-for="dict in customerOptions"
              :key="dict.customerId"
              :label="dict.customerName"
              :value="dict.customerName"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="提货单位" prop="pickUpCustomer">
          <el-input v-model="form.pickUpCustomer" placeholder="请输入提货单位" clearable />
        </el-form-item>
        <!--el-form-item label="发货方式" prop="exitTransportVehicle">
          <el-select v-model="form.exitTransportVehicle" placeholder="请选择发货方式" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.transport_mode"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item-->
        <el-form-item label="出库运输" prop="exitTransportMark">
          <el-select v-model="form.exitTransportMark" placeholder="请选择出库运输" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.transport_mark"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="出库车号" prop="exitWarehouseVehicle">
          <el-input v-model="form.exitWarehouseVehicle" placeholder="请输入出库车号" clearable @change="handleChangeToUpperCase(form.exitWarehouseVehicle)" @keyup.enter.native="handleVehicleLicenseNumber(form.exitWarehouseVehicle)"/>
        </el-form-item>
        <el-form-item label="出库司机" prop="exitWarehouseDriver">
          <el-input v-model="form.exitWarehouseDriver" placeholder="请输入出库司机" clearable />
        </el-form-item>
        <el-form-item label="联系电话" prop="exitWarehouseMobile">
          <el-input v-model="form.exitWarehouseMobile" placeholder="请输入联系电话" clearable />
        </el-form-item>
        <!--el-form-item label="身份证号" prop="identityCardNumber">
          <el-input v-model="form.identityCardNumber" placeholder="请输入身份证号" clearable />
        </el-form-item-->
        <!--el-form-item label="外部单号" prop="externalOrderNumber">
          <el-input v-model="form.externalOrderNumber" placeholder="请输入外部单号" clearable />
        </el-form-item-->
        <!--el-form-item label="捆包号" prop="bundleNumber">
          <el-input v-model="form.bundleNumber" placeholder="请输入捆包号" clearable />
        </el-form-item-->
        <el-form-item label="货物类型" prop="goodsType">
          <el-select v-model="form.goodsType" placeholder="请选择货物类型" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.goods_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <!--el-form-item label="品名" prop="product">
          <el-input v-model="form.product" placeholder="请输入品名" clearable />
        </el-form-item>
        <el-form-item label="规格" prop="specification">
          <el-input v-model="form.specification" placeholder="请输入规格" clearable />
        </el-form-item>
        <el-form-item label="材质" prop="steelGrade">
          <el-input v-model="form.steelGrade" placeholder="请输入材质" clearable />
        </el-form-item-->
        <el-form-item label="计重方式" prop="weightMode">
          <el-select v-model="form.weightMode" placeholder="请选择计重方式" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.weight_mode"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <!--el-form-item label="重量(吨)" prop="weight">
          <el-input v-model="form.weight" placeholder="请输入重量(吨)" :disabled="true" />
        </el-form-item-->
        <!--el-form-item label="磅重(吨)" prop="poundWeight">
          <el-input v-model="form.poundWeight" placeholder="请输入磅重(吨)" clearable />
        </el-form-item-->
        <!--el-form-item label="理重(吨)" prop="theoryWeight">
          <el-input v-model="form.theoryWeight" placeholder="请输入理重(吨)" clearable />
        </el-form-item-->
        <!--el-form-item label="毛重(吨)" prop="grossWeight">
          <el-input v-model="form.grossWeight" placeholder="请输入毛重(吨)" clearable @change="handleChangeWeight" />
        </el-form-item>
        <el-form-item label="皮重(吨)" prop="tareWeight">
          <el-input v-model="form.tareWeight" placeholder="请输入皮重(吨)" clearable @change="handleChangeWeight" />
        </el-form-item>
        <el-form-item label="净重(吨)" prop="netWeight">
          <el-input v-model="form.netWeight" placeholder="请输入净重(吨)" :disabled="true" />
        </el-form-item>
        <el-form-item label="扣重(吨)" prop="deductWeight">
          <el-input v-model="form.deductWeight" placeholder="请输入扣重(吨)" clearable @change="handleChangeWeight" />
        </el-form-item-->
        <!--el-form-item label="余重(吨)" prop="remainWeight">
          <el-input v-model="form.remainWeight" placeholder="请输入余重(吨)" clearable />
        </el-form-item-->
        <!--el-form-item label="件数" prop="numberOfPiece">
          <el-input v-model="form.numberOfPiece" placeholder="请输入件数" clearable />
        </el-form-item>
        <el-form-item label="合约号" prop="agreementNumber">
          <el-input v-model="form.agreementNumber" placeholder="请输入合约号" clearable />
        </el-form-item>
        <el-form-item label="合同号" prop="contractNumber">
          <el-input v-model="form.contractNumber" placeholder="请输入合同号" clearable />
        </el-form-item>
        <el-form-item label="生产日期" prop="produceDate">
          <el-date-picker clearable
            v-model="form.produceDate"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择生产日期"
            style="width: 340px;">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="记录来源" prop="recordSource">
          <el-input v-model="form.recordSource" placeholder="请输入记录来源" clearable />
        </el-form-item>
        <el-form-item label="库存状态" prop="inventoryStatus">
          <el-select v-model="form.inventoryStatus" placeholder="请选择库存状态" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.inventory_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item-->
        <!--el-form-item label="仓库类型" prop="warehouseType">
          <el-select v-model="form.warehouseType" placeholder="请选择仓库类型" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.warehouse_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item-->
        <!--el-form-item label="园区信息" prop="logisticsParkName">
          <el-select v-model="form.logisticsParkName" placeholder="请选择园区信息" style="width: 340px;" clearable @change="handleChangeLogisticsPark">
            <el-option
              v-for="dict in parkLocateOptions"
              :key="dict.locateId"
              :label="dict.name"
              :value="dict.name"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="仓位信息" prop="warehouseLocateName">
          <el-select v-model="form.warehouseLocateName" placeholder="请选择仓位信息" style="width: 340px;" clearable @change="handleChangeWarehouseLocate">
            <el-option
              v-for="dict in warehouseLocateOptions"
              :key="dict.locateId"
              :label="dict.name"
              :value="dict.name"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="区位信息" prop="regionLocateName">
          <el-select v-model="form.regionLocateName" placeholder="请选择区位信息" style="width: 340px;" clearable @change="handleChangeRegionLocate">
            <el-option
              v-for="dict in regionLocateOptions"
              :key="dict.locateId"
              :label="dict.name"
              :value="dict.name"
            ></el-option>
          </el-select>
        </el-form-item-->
        <!--el-form-item label="货位信息" prop="goodsLocateName">
          <el-select v-model="form.goodsLocateName" placeholder="请选择货位信息" style="width: 340px;" clearable @change="handleChangeGoodsLocate">
            <el-option
              v-for="dict in goodsLocateOptions"
              :key="dict.locateId"
              :label="dict.name"
              :value="dict.name"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="层位信息" prop="layerLocateName">
          <el-select v-model="form.layerLocateName" placeholder="请选择层位信息" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.sys_yes_no"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item-->
        <el-form-item label="库位信息" prop="warehouseTotalLocate">
          <el-input v-model="form.warehouseTotalLocate" placeholder="请输入库位信息" clearable />
        </el-form-item>
        <!--el-form-item label="目的流向" prop="endFlowDirection">
          <el-select v-model="form.endFlowDirection" placeholder="请选择目的流向" style="width: 340px;" clearable>
            <el-option
              v-for="dict in flowOptions"
              :key="dict.flowDirectionId"
              :label="dict.flowDirectionName"
              :value="dict.flowDirectionName"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="目的卸点" prop="endUnloadPoint">
          <el-input v-model="form.endUnloadPoint" placeholder="请输入目的卸点" clearable />
        </el-form-item-->
        <!--el-form-item label="运单编号" prop="wayBillNumber">
          <el-input v-model="form.wayBillNumber" placeholder="请输入运单编号" clearable />
        </el-form-item-->
        <el-form-item label="结算方式" prop="settlementMode">
          <el-select v-model="form.settlementMode" placeholder="请选择结算方式" style="width: 340px;">
            <el-option
              v-for="dict in dict.type.settlement_mode"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="出库时间" prop="exitWarehouseTime">
          <el-date-picker clearable
            v-model="form.exitWarehouseTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择出库时间"
            style="width: 340px;">
          </el-date-picker>
        </el-form-item>
        <!--el-form-item label="出库确认人" prop="exitWarehouseConfirmPerson">
          <el-input v-model="form.exitWarehouseConfirmPerson" placeholder="请输入出库确认人" clearable />
        </el-form-item>
        <el-form-item label="出库确认时间" prop="exitWarehouseConfirmTime">
          <el-date-picker clearable
            v-model="form.exitWarehouseConfirmTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择出库确认时间"
            style="width: 340px;">
          </el-date-picker>
        </el-form-item-->
        <!--el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" clearable />
        </el-form-item>
        <el-form-item label="作业状态" prop="jobStatus">
          <el-select v-model="form.jobStatus" placeholder="请选择作业状态" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.job_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="结算客户" prop="settlementCustomer">
          <el-select v-model="form.settlementCustomer" placeholder="请选择结算客户" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.sys_yes_no"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="结算方式" prop="settlementMode">
          <el-select v-model="form.settlementMode" placeholder="请选择结算方式" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.settlement_mode"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="账单编号" prop="billNumber">
          <el-input v-model="form.billNumber" placeholder="请输入账单编号" clearable />
        </el-form-item>
        <el-form-item label="账单状态" prop="billStatus">
          <el-select v-model="form.billStatus" placeholder="请选择账单状态" style="width: 340px;" clearable>
            <el-option
              v-for="dict in dict.type.bill_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="园区代码" prop="parkCode">
          <el-input v-model="form.parkCode" placeholder="请输入园区代码" clearable />
        </el-form-item-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加货物对话框 -->
    <!-- 使用组件-->
    <!--addGoodsDialog ref="addGoodsDialog" title="添加货物" open="false" :refreshGoodsDetail="refreshGoodsDetail" style="display: none;"/-->
    <waybillDialog ref="waybillDialog" title="添加货物" open="false" style="display: none;"/>
  </div>
</template>

<script>
import { listReceipt, getReceipt, delReceipt, addReceipt, updateReceipt, getExitWeightSum, revokeExitWarehouse } from "@/api/exitwarehouse/receipt";
import { listCustomerOption } from "@/api/customs/custom";
import { listFlowOption, updateFlow } from "@/api/system/flow";
//import addGoodsDialog from "./addGoodsDialog";
import goodsDetail from "./goodsDetail";
import { isNotNull } from "@/utils/validate";
import { getModeByCustomerName } from "@/api/fees/mode";
import { getDriverMobile } from "@/api/system/vehicledriver";
import { listLocateOption } from "@/api/locates/locate";
import waybillDialog from "./waybillDialog";

export default {
  components: {
//    addGoodsDialog, 
    goodsDetail,
    waybillDialog,
  },
  name: "Receipt",
  dicts: ['transport_mode', 'warehouse_type', 'job_status', 'sys_yes_no', 'settlement_mode', 'transport_mark', 'weight_mode', 'bill_status', 'goods_type', 'inventory_status'],
  data() {
    return {
      // 定义列表高度
      tableHeight: 430,
      // 定义查询高度
      queryHeight: 200,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出库单据表格数据
      receiptList: [],
      //选择列表
      selectList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 园区代码时间范围
      daterangeExitWarehouseTime: [],
      // 园区代码时间范围
      daterangeExitWarehouseConfirmTime: [],
      // 园区代码时间范围
      daterangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        exitWarehouseNumber: null,
        exitWarehouseCustomer: null,
        pickUpCustomer: null,
        exitTransportVehicle: null,
        exitTransportMark: null,
        exitWarehouseVehicle: null,
        exitWarehouseDriver: null,
        exitWarehouseMobile: null,
        identityCardNumber: null,
        externalOrderNumber: null,
        bundleNumber: null,
        goodsType: null,
        product: null,
        specification: null,
        steelGrade: null,
        weightMode: null,
        weight: null,
        poundWeight: null,
        theoryWeight: null,
        grossWeight: null,
        tareWeight: null,
        netWeight: null,
        deductWeight: null,
        remainWeight: null,
        numberOfPiece: null,
        agreementNumber: null,
        contractNumber: null,
        produceDate: null,
        recordSource: null,
        inventoryStatus: null,
        warehouseType: null,
        logisticsParkName: null,
        warehouseLocateName: null,
        regionLocateName: null,
        goodsLocateName: null,
        layerLocateName: null,
        warehouseTotalLocate: null,
        endFlowDirection: null,
        endUnloadPoint: null,
        wayBillNumber: null,
        exitWarehouseTime: null,
        exitWarehouseConfirmPerson: null,
        exitWarehouseConfirmTime: null,
        remark: null,
        jobStatus: null,
        settlementCustomer: null,
        settlementMode: null,
        billNumber: null,
        billStatus: null,
        parkCode: null,
        createBy: null,
        createTime: null,
      },
      // 表单参数
      form: {},
      // 字典项客户
      customerOptions: [],
      // 字典项流向
      flowOptions: [],
      // 字典项园区信息
      parkLocateOptions: [],
      // 字典项仓位信息
      warehouseLocateOptions: [],
      // 字典项区位信息
      regionLocateOptions: [],
      // 字典项货位信息
      goodsLocateOptions: [],
      // 已选行
      hasSelectRow: [],
      //作业状态
      jobStatus: '3',
      // 货物重量合计
      exitWeightSumList: [],
      // 表单校验
      rules: {
        exitWarehouseCustomer: [
          { required: true, message: "出库客户不能为空", trigger: "change" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getOption();
  },
  mounted() {
    this.$nextTick(() =>{
      // 根据浏览器高度设置初始高度 - 按钮行高度28 - 页码行高度28 - （面包屑+TAB行）高度160
      this.queryHeight = this.$refs.queryForm.$el.offsetHeight;
      this.tableHeight = window.innerHeight - this.queryHeight - 28 - 28 - 160;
      // 监听浏览器高度变化，改变表格高度
      window.onresize = () =>{
        this.tableHeight = window.innerHeight - this.queryHeight - 28 - 28 - 160;
      }
    })
  },
  methods: {
    /** 查询出库单据列表 */
    getList() {
      this.queryParams.jobStatus = this.jobStatus;
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeExitWarehouseTime && '' != this.daterangeExitWarehouseTime) {
        this.queryParams.params["beginExitWarehouseTime"] = this.daterangeExitWarehouseTime[0];
        this.queryParams.params["endExitWarehouseTime"] = this.daterangeExitWarehouseTime[1];
      }
      if (null != this.daterangeExitWarehouseConfirmTime && '' != this.daterangeExitWarehouseConfirmTime) {
        this.queryParams.params["beginExitWarehouseConfirmTime"] = this.daterangeExitWarehouseConfirmTime[0];
        this.queryParams.params["endExitWarehouseConfirmTime"] = this.daterangeExitWarehouseConfirmTime[1];
      }
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
      }
      listReceipt(this.queryParams).then(response => {
        this.receiptList = response.rows;
        this.total = response.total;
        this.loading = false;
        this.handleHasSelectRow();
        this.handleExitWeightSum();
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        exitWarehouseId: null,
        exitWarehouseNumber: null,
        exitWarehouseCustomer: null,
        pickUpCustomer: null,
        exitTransportVehicle: null,
        exitTransportMark: null,
        exitWarehouseVehicle: null,
        exitWarehouseDriver: null,
        exitWarehouseMobile: null,
        identityCardNumber: null,
        externalOrderNumber: null,
        bundleNumber: null,
        goodsType: null,
        product: null,
        specification: null,
        steelGrade: null,
        weightMode: null,
        weight: null,
        poundWeight: null,
        theoryWeight: null,
        grossWeight: null,
        tareWeight: null,
        netWeight: null,
        deductWeight: null,
        remainWeight: null,
        numberOfPiece: null,
        agreementNumber: null,
        contractNumber: null,
        produceDate: null,
        recordSource: null,
        inventoryStatus: null,
        warehouseType: null,
        logisticsParkName: null,
        warehouseLocateName: null,
        regionLocateName: null,
        goodsLocateName: null,
        layerLocateName: null,
        warehouseTotalLocate: null,
        endFlowDirection: null,
        endUnloadPoint: null,
        wayBillNumber: null,
        exitWarehouseTime: null,
        exitWarehouseConfirmPerson: null,
        exitWarehouseConfirmTime: null,
        remark: null,
        jobStatus: null,
        settlementCustomer: null,
        settlementMode: null,
        billNumber: null,
        billStatus: null,
        dataRealm: null,
        parkCode: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeExitWarehouseTime = [];
      this.daterangeExitWarehouseConfirmTime = [];
      this.daterangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.exitWarehouseId)
      this.single = selection.length!==1
      this.multiple = !selection.length
      this.selectList = selection;
    },
    /** 新增按钮操作 */
    handleAdd() {
      /** Date原型添加如下的方法 */
      Date.prototype.format = function(fmt) { 
        var o = { 
            "M+" : this.getMonth()+1,                 //月份 
            "d+" : this.getDate(),                    //日 
            "h+" : this.getHours(),                   //小时 
            "m+" : this.getMinutes(),                 //分 
            "s+" : this.getSeconds(),                 //秒 
            "q+" : Math.floor((this.getMonth()+3)/3), //季度 
            "S"  : this.getMilliseconds()             //毫秒 
        }; 
        if(/(y+)/.test(fmt)) {
                fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
        }
        for(var k in o) {
            if(new RegExp("("+ k +")").test(fmt)){
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
            }
        }
        return fmt; 
      };
      this.reset();
      this.open = true;
      this.title = "添加出库单据";
      this.$set(this.form, 'goodsType', this.dict.type.goods_type[0].label);
      this.$set(this.form, 'transportMark', this.dict.type.transport_mark[0].label);
      this.$set(this.form, 'recordSource', 'PC');
      this.$set(this.form, 'inventoryStatus', '出库中');
      this.$set(this.form, 'exitWarehouseTime', new Date().format("yyyy-MM-dd hh:mm:ss"));
      this.$set(this.form, 'jobStatus', this.jobStatus);
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const exitWarehouseId = row.exitWarehouseId || this.ids
      getReceipt(exitWarehouseId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改出库单据";
        this.handleLoadOptions();
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.exitWarehouseId != null) {
            updateReceipt(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addReceipt(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const exitWarehouseIds = row.exitWarehouseId || this.ids;
      let information;
//      console.log("task handleDelete row ", row);
      if(isNotNull(row.exitWarehouseNumber)){
        information = '是否删除出库单"' + row.exitWarehouseNumber + '"？';
      } else {
        information = '是否删除出库单？';
      }
      this.$modal.confirm(information).then(function() {
        return delReceipt(exitWarehouseIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('exitwarehouse/exit/export', {
        ...this.queryParams
      }, `receipt_${new Date().getTime()}.xlsx`)
    },
    computeTableHeight(){
      if( this.showSearch==true ){
        this.tableHeight = window.innerHeight - this.queryHeight - 28 - 28 - 160;
      } else {
        this.tableHeight = window.innerHeight - 28 - 28 - 160;
      }
    },
    getOption() {
      /** 字典项客户*/
      listCustomerOption().then(response => {
        this.customerOptions = response.data;

//        console.log('this.customerOptions',this.customerOptions);
      });
      listFlowOption().then(response => {
//        this.beginFlowOptions = JSON.parse(JSON.stringify(response.data));
        this.flowOptions = response.data;

      });
      /** 字典项园区 */
      listLocateOption(0).then(response => {
        this.parkLocateOptions = response.data;
//        console.log('this.parkLocateOptions',this.parkLocateOptions);
      });

    },
    handleChangeLogisticsPark(value) {
//      console.log('handleChangeLogisticsPark', value);
      let park = {};
      park = this.parkLocateOptions.find((item) => {
        return item.name === value; //筛选出匹配数据
      });
//      console.log('park', park);
//      this.form.logisticsParkName = value.name;
//      console.log('handleChangeLogisticsPark', label);
      /** 字典项仓库 */
      listLocateOption(park.locateId).then(response => {
        this.warehouseLocateOptions = response.data;
        this.regionLocateOptions = {};
        this.goodsLocateOptions = {};
        this.form.warehouseLocateName = '';
        this.form.regionLocateName = '';
        this.form.goodsLocateName = '';
        this.form.warehouseTotalLocate = '';
        this.form.warehouseType = '';
        //        console.log('this.warehouseLocateOptions',this.warehouseLocateOptions);
      });
    },
    handleChangeWarehouseLocate(value) {
//      console.log('handleChangeWarehouse', value);
      let warehouse = {};
      warehouse = this.warehouseLocateOptions.find((item) => {
        return item.name === value; //筛选出匹配数据
      });
      this.$set(this.form, 'warehouseType', warehouse.warehouseType);
//      console.log('warehouse', warehouse);
      /** 字典项区位 */
      listLocateOption(warehouse.locateId).then(response => {
        this.regionLocateOptions = response.data;
        this.goodsLocateOptions = {};
        this.form.regionLocateName = '';
        this.form.goodsLocateName = '';
//        console.log('this.regionLocateOptions',this.regionLocateOptions);
      });
    },
    handleChangeRegionLocate(value) {
//      console.log('handleChangeWarehouse', value);
      let region = {};
      region = this.regionLocateOptions.find((item) => {
        return item.name === value; //筛选出匹配数据
      });
//      console.log('region', region);
      /** 字典项货位 */
      listLocateOption(region.locateId).then(response => {
        this.goodsLocateOptions = response.data;
        this.form.goodsLocateName = '';

//        console.log('this.goodsLocateOptions',this.goodsLocateOptions);
      });
      this.handleChangeGoodsLocate();
    },
    handleChangeGoodsLocate(value) {
      this.form.warehouseTotalLocate = this.form.logisticsParkName + this.form.warehouseLocateName + this.form.regionLocateName + this.form.goodsLocateName;
    },
    //
    handleLoadOptions(){
//      if(this.form.logisticsParkName != ''){
      if(isNotNull(this.form.logisticsParkName)){
//        console.log("this.form.logisticsParkName = ", this.form.logisticsParkName);
        let park = {};
        park = this.parkLocateOptions.find((item) => {
          return item.name === this.form.logisticsParkName; //筛选出匹配数据
        });
        /** 字典项仓库 */
//        if (isNotNull(park)) {
        listLocateOption(park.locateId).then(response => {
          this.warehouseLocateOptions = response.data;

          if (this.form.warehouseLocateName != '') {
//            console.log("this.form.warehouseLocateName = ", this.form.warehouseLocateName);
            let warehouse = {};
            warehouse = this.warehouseLocateOptions.find((item) => {
              return item.name === this.form.warehouseLocateName; //筛选出匹配数据
            });
            /** 字典项区位 */
            listLocateOption(warehouse.locateId).then(response => {
              this.regionLocateOptions = response.data;
              if (this.form.regionLocateName != '') {
//                console.log("this.form.regionLocateName = ", this.form.regionLocateName);
                let region = {};
                region = this.regionLocateOptions.find((item) => {
                  return item.name === this.form.regionLocateName; //筛选出匹配数据
                });
                /** 字典项货位 */
                listLocateOption(region.locateId).then(response => {
                  this.goodsLocateOptions = response.data;
                });
              }
            });
          }
        });
//       }
      }
    },
    handleAddGoods(){
//      console.log("handleAddGoods");
//      this.$refs.addGoodsDialog.title = "添加货物";
//      this.$refs.addGoodsDialog.open = true;
//      this.openDialog = true;
/*      this.$nextTick(() => {
        this.$refs.addGoodsDialog.init(2);
      });*/
      //const tableData = this.$refs.table.getCheckboxRecords();
//      console.log("this.selectList.exitWarehouseNumber", this.selectList[0].exitWarehouseNumber);
      this.$refs.addGoodsDialog.init(true, "添加货物", this.selectList[0].exitWarehouseNumber, this.selectList[0]);
//      this.$refs.goodsDetail.getDetail(this.selectList[0].exitWarehouseNumber);
    },
    handleRowClick(row, column, event){
      //console.log("row = ", row.exitWarehouseNumber);
      //console.log("column = ", column);
      //console.log("event = ", event);
      if(this.selectList[0] == row)
      {
        this.selectList = [];
        this.$refs['dataList'].clearSelection();
        this.hasSelectRow = [];
      } else {
        this.selectList = [row];
        this.$refs['dataList'].clearSelection();
        this.$refs['dataList'].toggleRowSelection(row, true);
        this.hasSelectRow = [row];
      }
      this.$refs.goodsDetail.getDetailX(row.exitWarehouseNumber, row);
    },
    refreshGoodsDetail(exitWarehouseNumber){
      this.$refs.goodsDetail.getDetail(exitWarehouseNumber);
    },
    handleHasSelectRow(){
      if(isNotNull(this.hasSelectRow))
      {
        this.$nextTick(() => {
//          console.log("handleHasSelectRow", this.hasSelectRow[0].exitWarehouseId);
          //this.selectList = [this.hasSelectRow];
          this.receiptList.forEach((row) => {
//            console.log("handleHasSelectRow, receiptList", row.exitWarehouseId);
            if(row.exitWarehouseId === this.hasSelectRow[0].exitWarehouseId){
              //this.$refs['dataList'].clearSelection();
              this.$refs['dataList'].toggleRowSelection(row, true);
//              console.log("handleHasSelectRow, row", row);
              this.$refs.goodsDetail.getDetailX(this.hasSelectRow[0].exitWarehouseNumber, this.hasSelectRow[0]);
            }
          });
        });
      } else {
        if(isNotNull(this.receiptList)){
          if (isNotNull(this.receiptList[0].exitWarehouseNumber)) {
            this.handleSelectOneRow(this.receiptList[0]);
          }
        } else {
          this.$refs.goodsDetail.clearDetail();
        }
      }
    },
    handleSelectOneRow(row){
      this.$nextTick(() => {
        this.$refs['dataList'].toggleRowSelection(row, true);
        this.$refs.goodsDetail.getDetailX(row.exitWarehouseNumber, row);
        this.ids = row.exitWarehouseId;
        this.single = 1!=1;
        this.multiple = !1;
//        this.selectList.push(row);
        
      });
    },
    handleExitRevoke(row) {
      //const data = this.selectList[0];
      const data = {
        exitWarehouseId: this.selectList[0].exitWarehouseId,
        exitWarehouseNumber: this.selectList[0].exitWarehouseNumber,
        //exitWarehouseCustomer: this.selectList[0].exitWarehouseCustomer,
        //exitWarehouseDriver: this.selectList[0].exitWarehouseDriver,
        //exitWarehouseVehicle: this.selectList[0].exitWarehouseVehicle,
        //exitWarehouseTime: this.selectList[0].exitWarehouseTime,
        exitWarehouseConfirmTime: this.selectList[0].exitWarehouseConfirmTime,
        jobStatus: this.selectList[0].jobStatus,
      };
      //console.log(this.$refs.goodsDetail.getCheckStatus());
      this.$modal.confirm('是否撤销"' + this.selectList[0].exitWarehouseNumber + '"出库？').then(function() {
        return revokeExitWarehouse(data);
      }).then(() => {
        this.getList();
        this.hasSelectRow = [];
        this.$modal.msgSuccess("撤销成功");
      }).catch((e) => {
        console.log('e', e);
        this.getList();
//        this.$modal.msgError(e.msgError);
      });
    },
    handleChangeCustomer(value) {
//      console.log('handleChangeCustomer', value);
      getModeByCustomerName(value).then(response => {
        if(isNotNull(response.data)) {
          this.form.settlementMode = response.data.settlementMode;
        } else {
          this.form.settlementMode = '';          
        }
//        console.log('response.data.settlementMode', response.data.settlementMode);
      });
    },
    handleChangeToUpperCase(value) {
      this.form.exitWarehouseVehicle = value.toUpperCase();
    },
    /* 车牌号带出信息 */
    handleVehicleLicenseNumber(value) {
      if(value) {
        getDriverMobile(value).then(response => {
          if(response.data) {
            this.form.exitWarehouseDriver = response.data.driverName;
            this.form.exitWarehouseMobile = response.data.contactMobile;
          } else {
            this.form.exitWarehouseDriver = '';
            this.form.exitWarehouseMobile = '';
          }
        });
      }
    },
    handlePrint() {
//      console.log('handlePrint this.$route ', this.$route );
//      console.log('handlePrint this.$router ', this.$router );
      this.$router.push({
        path: '/printexit',
        query: {
          id: this.selectList[0].enterWarehouseId,
          list: this.selectList,
          name: '出库单打印'
        }
      })     
    },
    handleExitWeightSum() {
      let query = {
        exitWarehouseNumber: this.queryParams.exitWarehouseNumber,
        exitWarehouseCustomer: this.queryParams.exitWarehouseCustomer,
        pickUpCustomer: this.queryParams.pickUpCustomer,
        goodsType: this.queryParams.goodsType,
        exitTransportMark: this.queryParams.exitTransportMark,
        exitWarehouseVehicle: this.queryParams.exitWarehouseVehicle,
        weight: this.queryParams.weight,
        jobStatus: this.queryParams.jobStatus,
        createBy: this.queryParams.createBy,
        params: {}
      };
//      query.params = {};
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        query.params["beginCreateTime"] = this.daterangeCreateTime[0];
        query.params["endCreateTime"] = this.daterangeCreateTime[1];
      }

//      console.log('query', query);
      getExitWeightSum(query).then(response => {
        if(isNotNull(response.data)){
          this.exitWeightSumList = response.data;
        } else {
          this.exitWeightSumList = [];
        }
//        console.log('response.data = ', response.data);
      });
    },
    /**
     * 计算重量，净重，出库重量
     */
    handleChangeWeight(value){
      let netWeight = 0.0;
      let weight = 0.0;
      if(isNotNull(this.form.grossWeight) && isNotNull(this.form.tareWeight)){
        netWeight = parseFloat(this.form.grossWeight) - parseFloat(this.form.tareWeight);
        this.form.netWeight = Math.round(netWeight * 1000) / 1000;
      }
      if(isNotNull(this.form.deductWeight)){
        weight = parseFloat(this.form.netWeight) - parseFloat(this.form.deductWeight);
        this.form.weight = Math.round(weight * 1000) / 1000;
      } else {
        this.form.weight = this.form.netWeight;
      }
    },
    handleWaybill() {
//      console.log('handleWaybill');
      //this.$refs.waybillDialog.init(true, "推送运单", this.selectList[0].exitWarehouseNumber, this.selectList[0]);
      this.$refs.waybillDialog.init(true, "推送运单", this.ids, this.selectList);
    },
  }
};
</script>

<!--style rel="stylesheet/scss" lang="scss"-->
<style lang="less" scoped>
/* 横线 */
.line{
  float:right;
  width: 100%;
  height: 1px;
  margin-top: 0.5em;
  margin-bottom: 0.25em;
  background:#d4c4c4;
  position: relative;
  text-align: center;
}

</style>